package 数据结构.队列.优先队列;

import 数据结构.堆.数组堆.最大堆.MaxHeap;
import 数据结构.队列.Queue;

/**
 * @author Veng Su 1344114844@qq.com
 * @date 2018/7/26 10:26
 */
public class PriorityQueue<E extends Comparable<E>> implements Queue<E> {
    private MaxHeap<E> maxHeap;
    public PriorityQueue(){
        this.maxHeap=new MaxHeap<>();
    }

    @Override
    public void enQueue(E e) {
        maxHeap.add(e);
    }

    @Override
    public E deQueue() {
        return maxHeap.extractMax();
    }

    @Override
    public E getFront() {
        return maxHeap.findMax();
    }

    @Override
    public int getSize() {
        return maxHeap.size();
    }

    @Override
    public boolean isEmpty() {
        return maxHeap.isEmpty();
    }
}
